#!/usr/bin/python3
# -*- coding: utf-8 -*-

"""
本模块的所有方法返回的`datetime`类型的结果，都使用`UTC`时区。
"""

from datetime import datetime
from arrow import Arrow
from dateutil.tz import gettz, UTC


def now() -> datetime:
    """获取当前时间。"""
    return Arrow.utcnow().datetime


def local_now() -> datetime:
    """获取使用本地时区的当前时间。"""
    return Arrow.now().datetime


def local_datetime(
        year: int,
        month: int,
        day: int,
        hour: int = 0,
        minute: int = 0,
        second: int = 0
) -> datetime:
    """获取指定的时间，所有参数均针对本地时区。"""
    return Arrow(year, month, day, hour, minute, second, tzinfo=gettz()).to(UTC).datetime


def utc_datetime(
        year: int,
        month: int,
        day: int,
        hour: int = 0,
        minute: int = 0,
        second: int = 0
) -> datetime:
    """获取指定的时间，所有参数均针对`UTC`时区。"""
    return Arrow(year, month, day, hour, minute, second).datetime
